<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAdsystemTable extends Migration{
    /**
     * Run the migrations.
     * @return void
     */
    public function up(){
        //广告管理表
        Schema::create('ad_manage',function (Blueprint $table){
            $table->engine='MyISAM';
            $table->comment='广告管理表';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->string('title',60)->default('')->comment('标题');
            $table->integer('uid')->unsigned()->index('uid')->default(0)->comment('所属用户');
            $table->integer('com_id')->unsigned()->index('com_id')->default(0)->comment('所属企业');
            $table->tinyInteger('url_type')->unsigned()->default(0)->comment('链接类型');
            $table->string('url',100)->default('')->comment('url');
            $table->string('pic_url',100)->default('')->comment('图片地址');
            $table->integer('ad_slots')->unsigned()->default(0)->comment('广告位置');
            $table->integer('ad_site')->unsigned()->default(0)->comment('广告站点');
            $table->mediumInteger('width')->unsigned()->default(0)->comment('广告宽度');
            $table->mediumInteger('height')->unsigned()->default(0)->comment('广告高度');
            $table->dateTime('start_time')->comment('开始时间');
            $table->dateTime('end_time')->comment('结束时间');
            $table->text('explanation')->default('')->comment('广告说明');
            $table->tinyInteger('status')->unsigned()->default(0)->comment('激活或屏蔽(显示状态)');
            $table->timestamps();
        });
        //广告位置表
        Schema::create('ad_slots', function (Blueprint $table) {
            $table->engine = 'MyISAM';
            $table->comment='广告位置表';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->string('ad_name', 60)->default('')->comment('广告位名称');
            $table->string('ad_sign', 60)->unique()->default('')->comment('广告位标识');
            $table->tinyInteger('ad_number')->unsigned()->default(0)->comment('最大显示数目');
            $table->mediumInteger('width')->unsigned()->default(0)->comment('广告宽度');
            $table->mediumInteger('height')->unsigned()->default(0)->comment('广告高度');
            $table->timestamps();
        });
        //广告站点表
        Schema::create('ad_site', function (Blueprint $table) {
            $table->engine = 'MyISAM';
            $table->comment='广告站点表';
            $table->increments('id')->unsigned()->comment('自动增长主键');
            $table->string('site_name', 60)->default('')->comment('站点名称');
            $table->string('site_sign', 60)->unique()->default('')->comment('站点标识');
            $table->timestamps();
        });
    }
    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down(){
        Schema::dropIfExists('ad_slots');
        Schema::dropIfExists('ad_site');
        Schema::dropIfExists('ad_manage');
    }
}
